loop = 0;
loopDelay = 0;
waitCharEnd = 0;
mcN = "letter";

aLetters = new Array();

for (i = 0; i< numChar; i++){
  aLetters[i+0] = i;
  var letter =  this[mcN +i];
  letter._visible = true;
  letter.init = letterInit;
  letter.doEffect = effect;
  letter.number = i;
}

function letterInit(){
this.speed = this._parent.speed;
this.top = this._y - this._parent.top;
this.bottom = this._y + this._height /2;
this.gravity = this._parent.gravity ;
this.drag = this._parent.drag;
this.bounce = this._parent.bounce;
}

function effect(){
this._y +=  this.speed;
if(this._y + this._height /2 > this.bottom) {
  this._y = this.bottom - this._height/2;
  this.speed = -this.speed * this.bounce;
}
if(this._y - this._height/2 < this.top) {
  this._y = this.top + this._height/2;
  this.speed = -this.speed * this.bounce;
}
this.speed = this.speed * this.drag + this.gravity;
}

function shuffle(){
  return Math.floor(Math.random() * 3) -1;
}
if (random == 1){
  aLetters.sort(shuffle);
}

if (reverse == 1){
  aLetters.reverse();
}